<template>
	<!-- 产品信息 -->
	<view class="productInformation">
		<image :src="productInfo.productPic" mode=""></image>
		<view class="content">
			<view class="content_item">产品名称：<text>{{productInfo.productName}}</text></view>
			<view class="content_item">产品系列：<text>{{productInfo.productType}}</text></view>
			<view class="content_item">规   格：<text>{{productInfo.productSize}}</text></view>
			<view class="content_item">保质期：<text>{{productInfo.productGuaranteePeriod}}</text></view>
			<view class="content_item">储存方法：<text>{{productInfo.productStorage}}</text></view>
			<view class="content_item">产品数量：<text>{{productInfo.productEstimateCount}}</text></view>
			<view class="content_item">追溯批号：<text>{{batchNo}}</text></view>
			<!-- <view class="content_item">已扫码追溯次数：<text></text></view> -->
			<view class="content_item">负责人：<text>{{productInfo.productPerson}}</text></view>
			<view class="content_item">联系方式：<text>{{productInfo.productPersonPhone}}</text></view>
		</view>
	</view>
</template>

<script>
	// 		 				产品信息		
	import {imgUrl,getProductInfo} from "../../api/api_test.js"
	export default {
		data() {
			return {
				imgUrl:imgUrl,
				productId:'',
				productInfo:{},
				storeWay:[
					{dictValue:0,dictLabel:'正常存放'},
					{dictValue:1,dictLabel:'冷藏'},
					{dictValue:2,dictLabel:'风干'},
				],
				productType:[
					{dictValue:0,dictLabel:'普通'},
					{dictValue:1,dictLabel:'有机'},
					{dictValue:2,dictLabel:'进口'},
					{dictValue:3,dictLabel:'进口有机'},
				],
				batchNo:'',
			};
		},
		onLoad(options){
			this.batchNo = uni.getStorageSync('batchNo')
			this.productId = options.productId
			this.getInfo()
		},
		methods:{
			getInfo(){
				getProductInfo(uni.getStorageSync('id'),res=>{
					console.log("res",res)
					if(res.code == 200){
						this.productInfo = res.data
						this.productInfo.productPic = this.imgUrl + this.productInfo.productPic
						console.log("this.productInfo.productPic",this.productInfo.productPic)
						
						// 存储方式
						this.fn(this.storeWay,'productStorage')
						// 产品类型
						this.fn(this.productType,'productType')
					}
				})
			},
			fn(arr,para){
				arr.forEach(val=>{
					if(val.dictValue == this.productInfo[para]){
						console.log("res11111")
						this.productInfo[para] = val.dictLabel
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
.productInformation{
	flex: 1;
	background: url(../../static/maizi.png) no-repeat;
	background-size: 100% 100% ;
	box-sizing: border-box;
	>image{
		width: 100%;
		height: 450rpx;
	}
	.content{
		padding: 0 20rpx;
		box-sizing: border-box;
		font-size: 28rpx;
		// font-weight: bold;
		.content_item{
			line-height: 90rpx;
			display: flex;
			justify-content: space-between;
			border-bottom: 1px solid #B7B7B7;
			white-space: nowrap;
			text{
				color: #B7B7B7;
			}
		}
	}
}
</style>
